Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-draggable

Package Overview
Dependencies
Maintainers
2
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-draggable

React draggable component

  • 2.2.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.3M
increased by1.46%
Maintainers
2
Weekly downloads
 
Created

What is react-draggable?

The react-draggable npm package allows React components to be draggable within the DOM. It provides a simple way to make elements draggable and offers various customization options such as grid snapping, axis locking, and event handling for drag actions.

What are react-draggable's main functionalities?

Basic Dragging

This code snippet enables basic dragging functionality for the enclosed <div> element.

{"<Draggable><div>I can be dragged</div></Draggable>"}

Controlled Draggable

This example shows a controlled component where the position is managed by the component's state, allowing for more complex interactions.

{"<Draggable position={this.state.position} onDrag={this.handleDrag}><div>I can be dragged</div></Draggable>"}

Axis Constraints

This code restricts the dragging movement to the horizontal axis.

{"<Draggable axis='x'><div>I can only be dragged horizontally</div></Draggable>"}

Grid Snapping

This snippet makes the element snap to a grid pattern as it's being dragged.

{"<Draggable grid={[25, 25]}><div>I snap to a 25x25 grid</div></Draggable>"}

Bounds Limitation

This code ensures that the draggable element cannot be moved outside the bounds of its parent container.

{"<Draggable bounds='parent'><div>I can't be dragged outside my parent</div></Draggable>"}

Other packages similar to react-draggable

Keywords

FAQs

Package last updated on 30 Apr 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc